const data = {}
let text = "init"
const set = new Set()

Object.defineProperty(data, "text", {
    get() {
        set.add(effect)
        return text
    },
    set(val) {
        text = val
        set.forEach(ef => ef())
    }
})

function effect() {
    document.body.innerText = data.text
}

effect()
setTimeout(() => {
    data.text = "change"
}, 1000)
